package com.hyperf.core.util;

import com.hyperf.core.bean.result.Result;

/**
 * 判断结果集状态
 *
 * @author lizhaoyang
 */
public final class ResultUtil {

    public static <R> boolean isSuccess(Result<R> result) {
        return result != null && result.isStatus();
    }

    public static <R> boolean isSuccessNotNullData(Result<R> result) {
        return isSuccess(result) && result.getData() != null;
    }

    public static <R> boolean isFailure(Result<R> result) {
        return result == null || !result.isStatus();
    }
}
